{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "62b8633e",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid character in identifier (<ipython-input-2-e997b7d3b984>, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-2-e997b7d3b984>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m    日期：2022-09-14\u001b[0m\n\u001b[1;37m          ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid character in identifier\n"
     ]
    }
   ],
   "source": [
    "日期：2022-09-14\n",
    "python\n",
    "徐嘉悦"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e41adfe0",
   "metadata": {},
   "outputs": [],
   "source": [
    " # for+range()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6c18f1e0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d0d63e62",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(0,5))  #产生0-5个值    默认从0开始   0（start）   5(stop)   每一次增长一个单位"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "3ed7608e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(2, 5)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(2,5)      "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "ad1cd3d9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[2, 3, 4]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(2,5))    #产生5-2值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "91ec8489",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(1, 10, 3)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(1,10,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7e0bb2e0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 4, 7]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(1,10,3)) #start=1  stop=10   每一次增长3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "20b3c466",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.nfu.edu.cn/xxyw/index0.html\n",
      "https://www.nfu.edu.cn/xxyw/index1.html\n",
      "https://www.nfu.edu.cn/xxyw/index2.html\n",
      "https://www.nfu.edu.cn/xxyw/index3.html\n",
      "https://www.nfu.edu.cn/xxyw/index4.html\n"
     ]
    }
   ],
   "source": [
    "###练习：快速生成某个网站的所有页码URL队列\n",
    "南方学院学校要闻=\"https://www.nfu.edu.cn/xxyw/index\"\n",
    "页面后缀=\".html\"\n",
    "page=5\n",
    "for i in range(page):\n",
    "    print(南方学院学校要闻+str(i)+页面后缀)  #字符串拼接\n",
    "    time.sleep(4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "a1cfca51",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.nfu.edu.cn/xxyw/index0.html\n",
      "该次停留 8 秒\n",
      "https://www.nfu.edu.cn/xxyw/index1.html\n",
      "该次停留 1 秒\n",
      "https://www.nfu.edu.cn/xxyw/index2.html\n",
      "该次停留 10 秒\n",
      "https://www.nfu.edu.cn/xxyw/index3.html\n",
      "该次停留 7 秒\n",
      "https://www.nfu.edu.cn/xxyw/index4.html\n",
      "该次停留 3 秒\n"
     ]
    }
   ],
   "source": [
    "import random\n",
    "import time\n",
    "南方学院学校要闻=\"https://www.nfu.edu.cn/xxyw/index\"\n",
    "页面后缀=\".html\"\n",
    "page=5\n",
    "for i in range(page):\n",
    "    print(南方学院学校要闻+str(i)+页面后缀)  #字符串拼接\n",
    "    random_num=random.randint(1,10)\n",
    "    print(\"该次停留\",random_num,'秒')\n",
    "    time.sleep(random_num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9bbe34cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "#总结，for+range    for可以执行循环， range决定了循环体的执行次数 "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "67c05374",
   "metadata": {},
   "source": [
    "# 本周内容\n",
    ">1.random 模块\n",
    ">>1. random.random():生成0-1之间的 伪随机数(浮点型数)\n",
    ">>1. random.randint(a,b):生成ab之间的随机数（整数）\n",
    ">>1.random.choice():随机生成一个序列中的值（非空）\n",
    ">2.time 模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2f8b94c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "## 1.andom\n",
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "988fe9d2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "66.4520571854298"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.random()*200"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8d55509e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function random:\n",
      "\n",
      "random() method of random.Random instance\n",
      "    random() -> x in the interval [0, 1).\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random.random)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a899cdb8",
   "metadata": {},
   "outputs": [],
   "source": [
    "random.()          #按tab键"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "68d2a032",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on method randint in module random:\n",
      "\n",
      "randint(a, b) method of random.Random instance\n",
      "    Return random integer in range [a, b], including both end points.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "## 2. randint\n",
    "\n",
    "help(random.randint)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "f2e21bec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.randint(1,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "89a2fd80",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.randint(1,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "03470f5a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "5\n",
      "3\n",
      "4\n",
      "5\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    print(random.randint(1,6))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b0293fb4",
   "metadata": {},
   "outputs": [],
   "source": [
    "##3. random.choice"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "2ba73c2e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on method choice in module random:\n",
      "\n",
      "choice(seq) method of random.Random instance\n",
      "    Choose a random element from a non-empty sequence.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random.choice)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "b4595a91",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'han'"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random.choice([\"chan\",\"leeknow\",\"changbin\",\"hyunjin\",\"han\",\"felix\",\"seungmin\",\"in\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8f96daf7",
   "metadata": {},
   "source": [
    "2.time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "b732a042",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "5a1dd720",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function sleep in module time:\n",
      "\n",
      "sleep(...)\n",
      "    sleep(seconds)\n",
      "    \n",
      "    Delay execution for a given number of seconds.  The argument may be\n",
      "    a floating point number for subsecond precision.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(time.sleep)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "e21e18ba",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello\n",
      "world\n"
     ]
    }
   ],
   "source": [
    "print(\"hello\")\n",
    "time.sleep(3)\n",
    "print(\"world\")"
   ]
  },
  {
   "cell_type": "raw",
   "id": "116de93b",
   "metadata": {},
   "source": [
    "##3.课本实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "31ca29cb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "31\n",
      "现在是秒/时间为奇数\n",
      "等待时间为: 3\n",
      "34\n",
      "现在秒/时间为偶数\n",
      "等待时间为: 5\n",
      "39\n",
      "现在是秒/时间为奇数\n",
      "等待时间为: 5\n",
      "44\n",
      "现在秒/时间为偶数\n",
      "等待时间为: 4\n",
      "48\n",
      "现在秒/时间为偶数\n",
      "等待时间为: 4\n"
     ]
    }
   ],
   "source": [
    "import datetime\n",
    "import time,random\n",
    "odds=[1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,\n",
    "      53,55,57,59]\n",
    "#right_this_minute是一个变量，随着当前时间分钟数不断变化的一个值\n",
    "\n",
    "\n",
    "for i in range(5):\n",
    "    right_this_second=datetime.datetime.today().second\n",
    "\n",
    "    if right_this_second in odds:\n",
    "        print(right_this_second)\n",
    "        print(\"现在是秒/时间为奇数\")\n",
    "    else:\n",
    "        print(right_this_second)\n",
    "        print(\"现在秒/时间为偶数\")\n",
    "    wait_time=random.randint(1,5)\n",
    "    print(\"等待时间为:\",wait_time)\n",
    "    time.sleep(wait_time)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "004eee8b",
   "metadata": {},
   "outputs": [],
   "source": [
    "#项目3 p44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "1ea3686c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99\n",
      "98\n",
      "97\n",
      "96\n",
      "95\n",
      "94\n",
      "93\n",
      "92\n",
      "91\n",
      "90\n",
      "89\n",
      "88\n",
      "87\n",
      "86\n",
      "85\n",
      "84\n",
      "83\n",
      "82\n",
      "81\n",
      "80\n",
      "79\n",
      "78\n",
      "77\n",
      "76\n",
      "75\n",
      "74\n",
      "73\n",
      "72\n",
      "71\n",
      "70\n",
      "69\n",
      "68\n",
      "67\n",
      "66\n",
      "65\n",
      "64\n",
      "63\n",
      "62\n",
      "61\n",
      "60\n",
      "59\n",
      "58\n",
      "57\n",
      "56\n",
      "55\n",
      "54\n",
      "53\n",
      "52\n",
      "51\n",
      "50\n",
      "49\n",
      "48\n",
      "47\n",
      "46\n",
      "45\n",
      "44\n",
      "43\n",
      "42\n",
      "41\n",
      "40\n",
      "39\n",
      "38\n",
      "37\n",
      "36\n",
      "35\n",
      "34\n",
      "33\n",
      "32\n",
      "31\n",
      "30\n",
      "29\n",
      "28\n",
      "27\n",
      "26\n",
      "25\n",
      "24\n",
      "23\n",
      "22\n",
      "21\n",
      "20\n",
      "19\n",
      "18\n",
      "17\n",
      "16\n",
      "15\n",
      "14\n",
      "13\n",
      "12\n",
      "11\n",
      "10\n",
      "9\n",
      "8\n",
      "7\n",
      "6\n",
      "5\n",
      "4\n",
      "3\n",
      "2\n",
      "1\n"
     ]
    }
   ],
   "source": [
    "word=\"bottles\"\n",
    "for beer_num in range (99,0,-1):        #（a，b,c）b即停止值取不到\n",
    "    print(beer_num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "83af4e94",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 在啤酒墙上~~\n",
      "99 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "98 在啤酒墙上~~\n",
      "98 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "97 在啤酒墙上~~\n",
      "97 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "96 在啤酒墙上~~\n",
      "96 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "95 在啤酒墙上~~\n",
      "95 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "94 在啤酒墙上~~\n",
      "94 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "93 在啤酒墙上~~\n",
      "93 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "92 在啤酒墙上~~\n",
      "92 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "91 在啤酒墙上~~\n",
      "91 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "90 在啤酒墙上~~\n",
      "90 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "89 在啤酒墙上~~\n",
      "89 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "88 在啤酒墙上~~\n",
      "88 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "87 在啤酒墙上~~\n",
      "87 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "86 在啤酒墙上~~\n",
      "86 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "85 在啤酒墙上~~\n",
      "85 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "84 在啤酒墙上~~\n",
      "84 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "83 在啤酒墙上~~\n",
      "83 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "82 在啤酒墙上~~\n",
      "82 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "81 在啤酒墙上~~\n",
      "81 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "80 在啤酒墙上~~\n",
      "80 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "79 在啤酒墙上~~\n",
      "79 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "78 在啤酒墙上~~\n",
      "78 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "77 在啤酒墙上~~\n",
      "77 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "76 在啤酒墙上~~\n",
      "76 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "75 在啤酒墙上~~\n",
      "75 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "74 在啤酒墙上~~\n",
      "74 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "73 在啤酒墙上~~\n",
      "73 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "72 在啤酒墙上~~\n",
      "72 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "71 在啤酒墙上~~\n",
      "71 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "70 在啤酒墙上~~\n",
      "70 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "69 在啤酒墙上~~\n",
      "69 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "68 在啤酒墙上~~\n",
      "68 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "67 在啤酒墙上~~\n",
      "67 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "66 在啤酒墙上~~\n",
      "66 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "65 在啤酒墙上~~\n",
      "65 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "64 在啤酒墙上~~\n",
      "64 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "63 在啤酒墙上~~\n",
      "63 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "62 在啤酒墙上~~\n",
      "62 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "61 在啤酒墙上~~\n",
      "61 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "60 在啤酒墙上~~\n",
      "60 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "59 在啤酒墙上~~\n",
      "59 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "58 在啤酒墙上~~\n",
      "58 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "57 在啤酒墙上~~\n",
      "57 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "56 在啤酒墙上~~\n",
      "56 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "55 在啤酒墙上~~\n",
      "55 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "54 在啤酒墙上~~\n",
      "54 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "53 在啤酒墙上~~\n",
      "53 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "52 在啤酒墙上~~\n",
      "52 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "51 在啤酒墙上~~\n",
      "51 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "50 在啤酒墙上~~\n",
      "50 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "49 在啤酒墙上~~\n",
      "49 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "48 在啤酒墙上~~\n",
      "48 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "47 在啤酒墙上~~\n",
      "47 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "46 在啤酒墙上~~\n",
      "46 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "45 在啤酒墙上~~\n",
      "45 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "44 在啤酒墙上~~\n",
      "44 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "43 在啤酒墙上~~\n",
      "43 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "42 在啤酒墙上~~\n",
      "42 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "41 在啤酒墙上~~\n",
      "41 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "40 在啤酒墙上~~\n",
      "40 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "39 在啤酒墙上~~\n",
      "39 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "38 在啤酒墙上~~\n",
      "38 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "37 在啤酒墙上~~\n",
      "37 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "36 在啤酒墙上~~\n",
      "36 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "35 在啤酒墙上~~\n",
      "35 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "34 在啤酒墙上~~\n",
      "34 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "33 在啤酒墙上~~\n",
      "33 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "32 在啤酒墙上~~\n",
      "32 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "31 在啤酒墙上~~\n",
      "31 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "30 在啤酒墙上~~\n",
      "30 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "29 在啤酒墙上~~\n",
      "29 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "28 在啤酒墙上~~\n",
      "28 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "27 在啤酒墙上~~\n",
      "27 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "26 在啤酒墙上~~\n",
      "26 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "25 在啤酒墙上~~\n",
      "25 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "24 在啤酒墙上~~\n",
      "24 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "23 在啤酒墙上~~\n",
      "23 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "22 在啤酒墙上~~\n",
      "22 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "21 在啤酒墙上~~\n",
      "21 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "20 在啤酒墙上~~\n",
      "20 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "19 在啤酒墙上~~\n",
      "19 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "18 在啤酒墙上~~\n",
      "18 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "17 在啤酒墙上~~\n",
      "17 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "16 在啤酒墙上~~\n",
      "16 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "15 在啤酒墙上~~\n",
      "15 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "14 在啤酒墙上~~\n",
      "14 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "13 在啤酒墙上~~\n",
      "13 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "12 在啤酒墙上~~\n",
      "12 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "11 在啤酒墙上~~\n",
      "11 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "10 在啤酒墙上~~\n",
      "10 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "9 在啤酒墙上~~\n",
      "9 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "8 在啤酒墙上~~\n",
      "8 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "7 在啤酒墙上~~\n",
      "7 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "6 在啤酒墙上~~\n",
      "6 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "5 在啤酒墙上~~\n",
      "5 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "4 在啤酒墙上~~\n",
      "4 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "3 在啤酒墙上~~\n",
      "3 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottles 在啤酒墙上\n",
      "2 在啤酒墙上~~\n",
      "2 bottles 啤酒~~\n",
      "拿一瓶走~~\n",
      "new_num bottle 在啤酒墙上\n",
      "1 在啤酒墙上~~\n",
      "1 bottle 啤酒~~\n",
      "拿一瓶走~~\n",
      "只剩一瓶了，不能给你了！\n"
     ]
    }
   ],
   "source": [
    "word=\"bottles\"\n",
    "for beer_num in range (99,0,-1):        \n",
    "    print(beer_num,\"在啤酒墙上~~\")\n",
    "    print(beer_num,word,\"啤酒~~\")\n",
    "    print(\"拿一瓶走~~\")\n",
    "    if beer_num==1:\n",
    "        print(\"只剩一瓶了，不能给你了！\")\n",
    "    else:\n",
    "        new_num=beer_num-1\n",
    "        if new_num==1:\n",
    "           word=\"bottle\"\n",
    "        print(\"new_num\",word,\"在啤酒墙上\")\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c37cb2fd",
   "metadata": {},
   "outputs": [],
   "source": [
    "##课后任务：\n",
    "##思考：什么是有序的数据（seq type)\n",
    "* 预习：数值，字符串\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
